package cn.com.server.controller.systemManage;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.server.common.AjaxCodeUtil;
import cn.com.server.common.AjaxObject;
import cn.com.server.service.InfoService;
import cn.com.server.extend.model.InfoModel;

/**
 * <p>
 * 系统信息
 * </p>
 *
 * @author qing
 * @since 2017-11-22
 */
@Controller
@RequestMapping("/systemManage/info")
public class InfoController {
	
	@Autowired
	private InfoService infoService;
	
	@RequestMapping("/info")
	public String netWork(HttpServletRequest request, HttpServletResponse response) {
		return "/systemManager/info";
	}
	
	/**
	 * 传type可以取到不同类型状态,拿第一条数据可以拿到最新的一条数据
	 * @param model
	 * @param request
	 * @param response
	 * @param session
	 * @return
	 */
	@RequestMapping("/getInfo")
	@ResponseBody
	public AjaxObject getInfo(InfoModel model,HttpServletRequest request, HttpServletResponse response,HttpSession session) {
		AjaxObject ajaxObject = AjaxCodeUtil.getAjaxObject("success");
		ajaxObject.setData(infoService.selectInfoList(model));
		return ajaxObject;
	}
	
}
